package com.imessage.type;

import com.fasterxml.jackson.annotation.JsonValue;
import io.ebean.annotation.DbEnumValue;

import java.util.Objects;

public enum BusinessTaskCmd implements EnumMessage {

	copy_modify_virtual("2", "复制虚拟机,修改虚拟机名称和mac","copy_modify_virtual",""),
	start_virtual("3", "启动虚拟机","start_virtual",""),
	shutdown_virtual("4", "关机虚拟机","shutdown_virtual",""),
	restart_virtual("5", "重启虚拟机","restart_virtual",""),
	del_virtual("6", "删除虚拟机","del_virtual",""),
	replace_wuma("7", "更换五码","replace_wuma",""),
	send_single_msg("8", "发送单条短信","send_single_msg",""),
	send_batch_msg("9", "发送批量短信","send_batch_msg",""),
	other("99", "其他","other","");


	String code;
	String display;
	String name;
	String value;

	private BusinessTaskCmd(String code, String display, String name, String value) {
		this.code = code;
		this.display = display;
		this.name=name;
		this.value=value;
	}

	//获取枚举实例
	public static BusinessTaskCmd fromValue(String code) {
		for (BusinessTaskCmd statusEnum : BusinessTaskCmd.values()) {
			if (Objects.equals(code, statusEnum.getCode())) {
				return statusEnum;
			}
		}
		return BusinessTaskCmd.other;
	}

	//获取枚举实例
	public static BusinessTaskCmd toValue(String display) {
		for (BusinessTaskCmd statusEnum : BusinessTaskCmd.values()) {
			if (Objects.equals(display, statusEnum.getDisplay())) {
				return statusEnum;
			}
		}
		return BusinessTaskCmd.other;
	}

	@DbEnumValue
	@Override
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	@JsonValue
	public String getDisplay() {
		return display;
	}

	public void setDisplay(String display) {
		this.display = display;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
	@Override
	public String toString() {		
		return display;
	}


}
